package com.soul.common.enums;

/**
 * @author Shiws
 * @version 1.0
 * @date 2023/11/21 10:12
 */
public enum BizCacheKeyEnum {
    USER("po:user","用户"),
    DICT("po:dict","字典"),
    FILE("po:file","文件");

    private String code;
    private String message;

    BizCacheKeyEnum() {
    }

    BizCacheKeyEnum(String code, String message){
        this.code=code;
        this.message=message;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    /**
     * 根据code获取去value
     * @param code
     * @return
     */
    public static String getMessageByCode(String code){

        if(code != null ){
            for(BizCacheKeyEnum e : BizCacheKeyEnum.values()){
                if(code.equals(e.getCode())){
                    return e.getMessage();
                }
            }
        }
        return  null;
    }
}
